import { ApiProperty } from '@nestjs/swagger'

export class ImageCaptcha {
  @ApiProperty({ description: 'base64格式的svg图片' })
  img: string

  @ApiProperty({ description: '验证码对应的唯一ID' })
  id: string
}

export class LoginToken {
  @ApiProperty({ description: 'JWT身份Token' })
  token: string
}

export class LoginResponse {
  @ApiProperty({ description: '用户ID' })
  userId: number

  @ApiProperty({ description: '访问令牌' })
  accessToken: string

  @ApiProperty({ description: '刷新令牌' })
  refreshToken: string

  @ApiProperty({ description: '过期时间戳' })
  expiresTime: number
}

export class UserInfo {
  @ApiProperty({ description: '用户ID' })
  id: number

  @ApiProperty({ description: '昵称' })
  nickname: string

  @ApiProperty({ description: '头像' })
  avatar: string

  @ApiProperty({ description: '部门ID' })
  deptId: number

  @ApiProperty({ description: '用户名' })
  username: string

  @ApiProperty({ description: '邮箱' })
  email: string
}

export class MenuInfo {
  @ApiProperty({ description: '菜单ID' })
  id: number

  @ApiProperty({ description: '父菜单ID' })
  parentId: number

  @ApiProperty({ description: '菜单名称' })
  name: string

  @ApiProperty({ description: '路由地址' })
  path: string

  @ApiProperty({ description: '组件路径' })
  component: string

  @ApiProperty({ description: '组件名' })
  componentName: string

  @ApiProperty({ description: '菜单图标' })
  icon: string

  @ApiProperty({ description: '是否可见' })
  visible: boolean

  @ApiProperty({ description: '是否缓存' })
  keepAlive: boolean

  @ApiProperty({ description: '是否总是显示' })
  alwaysShow: boolean

  @ApiProperty({ description: '子菜单', type: [MenuInfo] })
  children: MenuInfo[]
}

export class PermissionInfoResponse {
  @ApiProperty({ description: '用户信息', type: UserInfo })
  user: UserInfo

  @ApiProperty({ description: '角色列表', type: [String] })
  roles: string[]

  @ApiProperty({ description: '权限列表', type: [String] })
  permissions: string[]

  @ApiProperty({ description: '菜单列表', type: [MenuInfo] })
  menus: MenuInfo[]
}
